package com.example.dllo.my36kr.share;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by dllo on 16/8/16.
 */
public class ShareAdapter extends FragmentPagerAdapter {
    ArrayList<String> arrayList = new ArrayList<>();
    ArrayList<Fragment>fragments;

    public void setFragments(ArrayList<Fragment> fragments) {
        this.fragments = fragments;
        arrayList.add("全部");
        arrayList.add("募资中");
        arrayList.add("募资完成");
        arrayList.add("融金成功");
    }



    public ShareAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments != null ? fragments.size() : 0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return arrayList.get(position);
    }
}
